<?php
/* @var $this ProfessionController */
/* @var $model Profession */
/* @var $form TbActiveForm */
?>

<style type="text/css">
       
        .help-inline
        {
            color:#b94a48;
        }
</style>        

<div class="form">

    <?php $form=$this->beginWidget('bootstrap.widgets.TbActiveForm', array(
	'id'=>'profession-form',
	// Please note: When you enable ajax validation, make sure the corresponding
	// controller action is handling ajax validation correctly.
	// There is a call to performAjaxValidation() commented in generated controller code.
	// See class documentation of CActiveForm for details on this.
	'enableAjaxValidation'=>false,
)); ?>

    <?php echo $form->errorSummary($model); ?>

            <?php echo $form->textFieldControlGroup($model,'name',array('span'=>5,'maxlength'=>256)); ?>

            <?php echo $form->textAreaControlGroup($model, 'description', array('span' => 5, 'rows' => 6,'maxlength'=>2048)); ?>
            
            <?php echo $form->textFieldControlGroup($model,'mobile',array('span'=>5,'placeholder' => Yii::t('profession_messages','profession.mobile.required'))); ?>

            <?php echo $form->textFieldControlGroup($model,'email',array('span'=>5,'maxlength'=>256)); ?>

			
			<?php echo $form->dropDownListControlGroup($model, 'professionType_id',
       				 CHtml::listData(ProfessionType::model()->findAll(), 'id', 'nameLocalized'), array('prompt' => Yii::t('default','choose.from.list'),)); ?>
			
			<div class="row">
			 <?php echo CHtml::label( Yii::t('profession_messages','profession.state_id'),'state_id') ?>
		        
		         <?php
                echo $form->dropDownList($model,'state_id', CHtml::listData(State::model()->findAll(), 'id', 'nameLocalized'), array(
                    'prompt' => Yii::t('default','choose.from.list'),
                    'ajax' => array(
                        'type' => 'POST',
                        'url' => CController::createUrl('profession/ajaxGetRegions'),
                        'update' => '#region_id',
                        'data' => array('state_id' => 'js:this.value'),
                        )));

                ?>
                
                <div><?php echo $form->error($model,'state_id'); ?></div>
                
 			</div> 
 
			 <div class="row">
						 <?php echo CHtml::label( Yii::t('profession_messages','profession.region_id'),'region_id') ?>
						 
						 <?php echo $form->dropDownList($model,'region_id', CHtml::listData(Region::model()->findAll('state_id=:state_id',array(':state_id'=>$model->state_id)), 'id', 'nameLocalized'),array('prompt' => Yii::t('default','choose.from.list'),'id'=>'region_id')); ?>
						 
						 <div><?php echo $form->error($model,'region_id'); ?></div>  
			</div>	
			
			<br/>
			<?php echo $form->hiddenField($model, 'lat'); ?>
			<?php echo $form->hiddenField($model, 'long'); ?>
			<div>
			<?php 
				$this->widget('coordinatepicker.CoordinatePicker', array(
						'model' => $model,
						'latitudeAttribute' => 'lat',
						'longitudeAttribute' => 'long',
						//optional settings
						'editZoom' => 19,
						'pickZoom' => 5,
						'defaultLatitude' => 30.043789,
						'defaultLongitude' => 31.236421,
				));
			?>
		</div>
      
	<div class="row buttons">
        <?php echo TbHtml::submitButton($model->isNewRecord ? Yii::t('default','Save'):Yii::t('default','Update'),array(
		    'color'=>TbHtml::BUTTON_COLOR_PRIMARY,
		    'size'=>TbHtml::BUTTON_SIZE_DEFAULT,
		)); ?>
	</div>
	
	

    <?php $this->endWidget(); ?>

</div><!-- form -->